home *** CD-ROM | disk | FTP | other *** search
- // LF2 Engine
- // (C) 2002-3 7FX
- //---------------------------------------------------------------------------
- // Header file with fog functions
- //---------------------------------------------------------------------------
- // Fog - input: view vertex position - output: fog factor
- // Linear fog formula
- float LinearFog(const float3 viewPos)
- {
- // f = (end - d)/(end - start)
- return (500.f - viewPos.z)/(500.f - 0.f);
- }
- //---------------------------------------------------------------------------
- // Exponential fog formula
- float ExpFog(const float3 viewPos)
- {
- // f = 1.f/(e^(d * density))
- return 1.0f/(pow(SC_E, viewPos.z * 0.005f));
- }
- //---------------------------------------------------------------------------
-